<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>[订单] 列表</h2>
    </div>
	<div class="cf">
		<div class="fl">
		<empty name="model.extend">
			<div class="tools">
				<!--<a class="btn" href="{:U('add?model='.$model['id'])}">新 增</a>-->
				<button class="btn ajax-post confirm" target-form="ids" url="{:U('order_del')}">删 除</button>
			</div>
		</empty>
		</div>
		<!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
                <input style="width: 210px" type="text" name="key" class="search-input" value="<?php echo $_GET['key']?>" placeholder="请输入用户名/用户手机号/订单号/">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('tbd/order')}"><i class="btn-search"></i></a>
			</div>
            <!--<div class="btn-group-click adv-sch-pannel fl">-->
                <!--<button class="btn">高 级<i class="btn-arrowdown"></i></button>-->
                <!--<div class="dropdown cf">-->
                	<!--<div class="row">-->
                		<!--<label>更新时间：</label>-->
                		<!--<input type="text" id="time-start" name="time-start" class="text input-2x" value="" placeholder="起始时间" /> - -->
                		<!--<input type="text" id="time-end" name="time-end" class="text input-2x" value="" placeholder="结束时间" />-->
                	<!--</div>-->
                	<!--<div class="row">-->
                		<!--<label>创建者：</label>-->
                		<!--<input type="text" name="nickname" class="text input-2x" value="" placeholder="请输入用户名">-->
                	<!--</div>-->
                <!--</div>-->
            <!--</div>-->
		</div>
	</div>


    <!-- 数据列表 -->
    <div class="data-table">
        <div class="data-table table-striped">
            <table>
                <!-- 表头 -->
                <thead>
                    <tr>
                        <th class="row-selected row-selected">
                            <input class="check-all" type="checkbox">
                        </th>
                       <th>id</th>
                       <th>订单号</th>
                       <th>用户名</th>
                       <th>手机号码</th>

                       <th>银行卡</th>
                       <th>银行手机号</th>
                       <th>银行归属</th>

                       <th>借贷金额</th>
                       <th>固定周期</th>
                        <th>申请时间</th>
                        <th>借贷状态</th>
                       <th>放款时间</th>
                       <th>最后还款时间</th>
                        <th>凭证</th>

                       <th>操作</th>
                    </tr>
                </thead>

                <!-- 列表 -->
                <tbody>
                <?php foreach($data as $v){?>

                        <tr>
                            <td class="row-selected row-selected">
                                <input class="ids row-selected" type="checkbox" name="id[]" value="<?php echo $v['id']?>">
                            </td>
                            <td><?php echo $v['id']?></td>
                            <td><?php echo $v['ordersn']?></td>
                            <td><?php echo $v['user']?></td>
                            <td><?php echo $v['phone']?></td>

                            <td><?php echo $v['yhkh']?></td>
                            <td><?php echo $v['yhkphone']?></td>
                            <td><?php echo $v['yhkgs']?></td>

                            <td><?php echo $v['jdje']?></td>
                            <td><?php echo $v['ts']?></td>
                            <td><?php echo $v['stime']?></td>
                            <td>
                                <?php if($v['start']==1){?>
                                <span class="hisActive" style="color: #ffc61a">未缴费</span>
                                <?php }else if($v['start']==2){?>
                                <span class="hisActive" style="color: #0bb20c">已缴费</span>
                                <?php }else if($v['start']==3){?>
                                <span class="hisActive" style="color: #ffdf2e">已放款</span>
                                <?php }else if($v['start']==4){?>
                                <span class="hisActive" style="color: #ff1fd3">已还款</span>
                                <?php }else if($v['start']==5){?>
                                <span class="hisActive" style="color: #ff0849">已取消</span>
                                <?php }?>
                            </td>

                            <td><?php echo $v['etime']?></td>
                            <td><?php echo date('Y-m-d H:i:s',strtotime($v['etime'])+($v['ts']*24*60*60))?></td>
                            <td><a href="<?php echo $v['pz']?>" target="_blank"><img style="width: 100px;
    height: 80px;" src="<?php echo $v['pz']?>" alt=""></a></td>
                            <td>
                                <a title="编辑" href="<?php echo U('order_edit&id='.$v['id'])?>">编辑</a>
                                <a title="查看详情" target="_blank" href="<?php echo U('member_msg&id='.$v['m_id'])?>">查看会员资料</a>
                                <a class="confirm ajax-get" title="删除" href="<?php echo U('order_del&id='.$v['id'])?>">删除</a>
                            </td>
                        </tr>

                <?php }?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        {$_page|default=''}
    </div>
</block>

<block name="script">
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

})
</script>
</block>
